package com.fenghongzhang.day007;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

import androidx.appcompat.app.AppCompatActivity;

import java.util.HashMap;
import java.util.Map;

public class Main4Activity<map> extends AppCompatActivity {
    private EditText edit;
    private Button send;

    public static Map<String,Object> map = new HashMap<>();


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main4);


        edit = (EditText) findViewById(R.id.edit);
        send = (Button) findViewById(R.id.send);

        send.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String string = edit.getText().toString();
                String string1 = edit.getText().toString();
                Intent intent = new Intent(Main4Activity.this, Main5Activity.class);
                //1,直接传值
//                intent.putExtra("name",string);

                //2,借助bundle (map)
//                Bundle bundle = new Bundle();
//                bundle.putString("name1",string);
//                //和intent结合
//                intent.putExtras(bundle);

                //3,静态标量传值
//                name = string;
//                map.put("1",string);
//                map.put("2",string1);

                //4.app
                MyApp myApp = (MyApp) getApplication();
                myApp.name = string;

                startActivity(intent);
            }
        });
    }
}
